using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Reflection;
using Deepcode.Flux.Core.Extensions;
using Deepcode.Flux.Core.Systems.Security;

public partial class Public_Notify_Error : Deepcode.Flux.Core.UI.NonCachePage
{
	protected void Page_Load(object sender, EventArgs e)
    {
		if (!Page.IsPostBack)
		{
			// Use skin logo
			AddinTreeNode lfNode = AddinTree.Tree.GetTreeNode("/Flux/LookFeel");
			string ai_logo = (string)lfNode.BuildChildItem("loginLogo", this);
			_logo.ImageUrl = ai_logo;

			// Get the reason
			string Reason = Request["Reason"];
			if( Reason == null ) Reason = "UNKNOWN";

			// See if we have an ASCX file for the error
			// and if not, use generic.ascx
			string ControlFile = Reason + ".ascx";
			if( ! System.IO.File.Exists(Server.MapPath("~/admin/Public/Notify/errors/" + ControlFile)))
				ControlFile = "Generic.ascx";
			
			// Load the control and add it to the page
			try
			{
				Control c = LoadControl("errors/" + ControlFile);
				loaderror.Controls.Add(c);
			}
			catch
			{
				Label l = new Label();
				l.CssClass = "error";
				l.Text = Reason;
				loaderror.Controls.Add( l );
			}
		}
    }

}
